package com.example.export_data.service;

import com.example.WebApplication;
import com.example.export_data.bean.User;
import com.example.export_data.mapper.UserDetailJpa;
import com.example.export_data.mapper.UserExpandJpa;
import com.example.export_data.mapper.UserJpa;
import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
import org.springframework.test.context.junit4.SpringRunner;

import javax.annotation.Resource;
import java.util.List;

@RunWith(SpringRunner.class)
@SpringBootTest(classes = WebApplication.class)
@Slf4j
public class ImportUserService {
    @Resource
    private UserJpa userJpa;

    @Resource
    private UserDetailJpa userDetailJpa;

    @Resource
    private UserExpandJpa userExpandJpa;

    @Test
    public void readUserInfo() {
        int page = 0;
        List<User> list = getUserInfo(++page);

    }

    public List<User> getUserInfo(int page) {
        int size = 100;
        Page<User> users = userJpa.findAll(PageRequest.of(page, size, Sort.by("wid")));
        return users.getContent();
    }

    private void userLoginDetail() {
    }
}
